﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Class2
    {
        class FindArrayIndex
        {
            public static void Demo02()
            {
                int[] arr = { 111, 123, 5, 665, 25 };
                Console.WriteLine(string.Join(",", arr));
                Console.WriteLine("请输入一个数:");
                int num = int.Parse(Console.ReadLine());

                int index = Array.IndexOf(arr, num);
                if (index == -1)
                {
                    Console.WriteLine("你输入的{0}不存在!", num);
                }
                else
                {
                    Console.WriteLine("你输入的数是{0}索引是:{1}", num, index);
                }
            }
        }
    }
}
